﻿using System.Collections.Generic;
using System.Web.Http;
using Pansoft.HIME.Base.Interfaces;
using Pansoft.HIME.Base.ViewModels.Statistics;

namespace Pansoft.HIME.Controllers.Api.Statistics
{
    public class WorkLoadStatisticsController:ApiController
    {
        private readonly IWorkLoadRepository _WorkLoadRepository;
        public WorkLoadStatisticsController(IWorkLoadRepository workLoadRepository)
        {
            _WorkLoadRepository = workLoadRepository;
        }

        public BatchDataViewModel<WorkLoadStatisticsViewModel> Post(QueryParam queryParam)
        {
            int totalcount;
            var result = _WorkLoadRepository.Get(queryParam, out totalcount);
            if (totalcount == 0)
            {
                return new BatchDataViewModel<WorkLoadStatisticsViewModel>(new List<WorkLoadStatisticsViewModel>(), 0);
            }
            return new BatchDataViewModel<WorkLoadStatisticsViewModel>(result, totalcount);
        }
    }
}